﻿/// <reference path="./Scripts/typings/jquery/jquery.d.ts" />
/// <reference path="./Scripts/typings/angularjs/angular.d.ts" />
/// <reference path="./Scripts/typings/signalr/signalr.d.ts" />

interface ISyncClient {
    addMessage(message: string);
    lastSessionStatus(status: string);
    progressChange(status: string);
    isSyncAutomatic(isSyncAutomatic: boolean);
    isSyncChange(sync: boolean);
    errorPolicy(err: string);
    nextAutoStart(dt: string);
    currentDatabaseGroup(group: string);
    lastDatabaseGroup(group: string);
    serviceStatus(string);
    machineName(message: string);
    skipCloning(skipCloning: string);
}

interface SyncStepsResponse {
    Items: ISyncStep[];
}

interface ISyncStep {
    Name: string;
    ExecutionOrder: number;
    Execute: boolean;
}

interface GetStateResponse {
    State: ISyncronizationState;
}

interface ISyncronizationState {
    StartDate: any;
    Messages: string[];
    Steps: ISyncStep[];
    Status: string;
    Progress: string;
    LastSyncDate: any;
    ServiceStatus: string;
}

interface ISyncServer {
    send(message: string): JQueryPromise<any>;
    startManualSync(steps: ISyncStep[]): JQueryPromise<any>;
    cancelSync(): JQueryPromise<any>;
    getSyncSteps(): JQueryPromise<SyncStepsResponse>;
    getState(): JQueryPromise<GetStateResponse>;
    isSynchronizing(): JQueryPromise<boolean>;
}

interface SyncHubProxy {
    client: ISyncClient;
    server: ISyncServer;
}

interface SignalR {
    syncHub: SyncHubProxy;
}
